package tool

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

func Success(c *gin.Context,code int,msg string,list interface{})  {
	c.JSON(http.StatusOK,gin.H{
		"code":code,
		"msg":msg,
		"data":list,
	})
   return
}

func SuccessAdmin(c *gin.Context,code int,msg string,count int,list interface{})  {
	c.JSON(http.StatusOK,gin.H{
		"code":code,
		"msg":msg,
		"count":count,
		"data":list,
	})
	return
}


func Error(c *gin.Context,code int,msg string)  {
	c.Abort()
	c.JSON(http.StatusOK,gin.H{
		"code":code,
		"msg":msg,
	})
	return
}